<template>
    <a-card :bordered="false">
        <div class="table-operator">
            <a-button shape="round" size="small" type="primary" icon="plus" @click="handleEdit({},'cronForm','新增')">添加</a-button>
        </div>

        <LTable
        ref="cronList"
        size="middle"
        rowKey="keyId"
        :formAttributes="formAttributes"
        :columns="columns"
        axiosUrl="/SysCronController/page"
        :initQuery="initQuery"
        :showPagination="true"
        :showQueryForm="true"
      >
        <span slot="isUse" slot-scope="text,record">
            <a-icon v-if="record.isUse==1" type="check" :style="{ color: 'green' }"/>
            <a-icon v-else type="close" :style="{ color: 'hotpink',fontSize: '14px'}"/>
      </span>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record,'cronForm',record.taskName)">编辑</a>
        </span>
        
    </LTable>
    <cronForm ref="cronForm" @close="refresh('cronList')" @ok="refresh('cronList')"></cronForm> 
    </a-card>
</template>

<script>
import LTable from '@/components/lt/LTable'
import cronForm from './cronForm'
import {SysMixin} from '@/mixins/SysMixin'
import defaultSettings from '@/config/defaultSettings'

export default {
    name:'cronList',
    components:{
       LTable,cronForm
    },
    mixins:[SysMixin],
    data(){
        return{
            formAttributes:[
                {field:'taskName',label:'任务名称',component:'input',condition:'like'},
            ],
            initQuery:[{field:'systemNo',val:defaultSettings.systemNo}],
            columns:[
                {
                    title: '序号',
                    dataIndex: '',
                    key:'rowIndex',
                    width:60,
                    align:"center",
                    customRender:function (t,r,index) {
                      return parseInt(index)+1;
                    }
                },
                
                {
                    title: '任务名称',
                    dataIndex: 'taskName'
                },
                {
                    title: '系统编号',
                    dataIndex: 'systemNo'
                    
                },
                {
                    title: '任务执行类',
                    dataIndex: 'taskClass'
                },
                {
                    title:'cron表达式',
                    dataIndex:'taskCron'
                },
                {
                    title: '是否启用',
                    dataIndex: 'isUse',
                    scopedSlots: { customRender: 'isUse' }
                },
                {
                    title: '操作',
                    dataIndex: 'action',
                    width: '120px',
                    scopedSlots: { customRender: 'action' }
                }
            ],
            
        }
    },
    created(){
       
    },
    methods:{
        
        
    }
}
</script>